<template>
	<view style="width: 100vw;display: flex;justify-content: center;">
		<view class="page-content">
			<view style="display: flex;justify-content: end;">
				<view class="add-btn" @click="cancel">
					<span class="btn-text">返回</span>
				</view>
				
			</view>
			<view class="title">设备管理</view>

			<view style="display: flex;justify-content: center;margin-top: 2.8vh;margin-bottom: 2.8vh;">
				<view style="background:rgba(13,46,105, 0.41);border-radius: 8px;width: 50vw;height: 4.4vh">
					<view style="opacity: 1;display: flex;justify-content: space-around;align-items: center;height: 100%;">
						<span class="def-text">尺寸ID</span>
						<span class="def-text">尺寸项</span>
						<span class="def-text">标注值</span>
						<span class="def-text">上公差</span>
						<span class="def-text">下公差</span>
						<span class="def-text">测量值</span>
						<span class="def-text">偏差值</span>
						<span class="def-text">超差值</span>
						<span class="def-text">结果</span>
						<span class="def-text">时间</span>
					</view>
				</view>
			</view>
			<view v-for="(item,index) in dataList" style="display: flex;justify-content: center;margin-top: 1vh;">
				<view style="background-image: linear-gradient(90deg, rgba(186,232,255,0.05) 1%, rgba(186,232,255,0.01) 46%, rgba(186,232,255,0.05) 100%);border-radius: 8px;width: 50vw;height: 4.4vh">
					<view style="opacity: 1;display: flex;justify-content: space-around;align-items: center;height: 100%;">
						<span class="def-text">{{ item.DimensionID }}</span>
						<span class="def-text">{{ item.DimensionName }}</span>
						<span class="def-text">{{ item.NormalVal }}</span>
						<span class="def-text">{{ item.UpperTolVal }}</span>
						<span class="def-text">{{ item.LowerTolVal }}</span>
						<span class="def-text">{{ item.MeasureValue }}</span>
						<span class="def-text">{{ item.Deviation }}</span>
						<span class="def-text">{{ item.DataOutTolVal }}</span>
						<span class="def-text">{{ item.MeasureResult }}</span>
						<span class="def-text">{{ item.MeasureTime }}</span>
					</view>
				</view>
			</view>
		
			</view>

		</view>
	</view>

</template>

<script>
	import config from '@/config.js'
	
	import {
		getAllDevices,
		MeasureResultDetail
	} from '@/api/device.js'
	
	export default {
		data() {
			return {
				devicename: '',
				workshop:'',
				deviceList: [],
				diagShow: false,
				dataList: [],
				workshopList: [],
				value: '',
				baseurl:"",
				userworkshopid:"",
				WorkpieceID:""
			}
		},
		created() {
			this.userid = config.userid
			this.baseurl=config.domain
			this.userworkshopid=config.workshopid
		},
		methods: {
			setworkpieceid(id)
			{
				this.WorkpieceID=id;
			},
			getMeasureResultDetail() {
				//弹出详情显示
				 MeasureResultDetail({
					data: {
						workpieceid: this.WorkpieceID
					}
				}).then(res => {
					if (res.data.statuscode == 1) {
						console.log("%%%%%%%%%%%%%", res.data.data)
				        this.dataList=res.data.data
					} else {
						console.log('Error:MeasureResult failed');
					}
				
				});
				
			},
			
			cancel(){
				this.$emit("hidedetail")
			},
			
			deleteDevice(device)
			{
				DeleteDevice({
					data: {
						devicename: device.devicename
					}
				}).then((res) => {
					
					if(res.data.statuscode==0)
					{
						uni.showToast({
							title: '失败'
						});
					}
					else	
					{
						uni.showToast({
							title: '成功'
						});
						this.AllDevices();
					}
				})
				
			}
		}
	}
</script>

<style scoped>
	/* // 设置下拉框的背景颜色及边框属性； */
	/deep/.el-select-dropdown {
		// 若不将下拉框的背景颜色设置为：transparent，那么做不出来半透明的效果；
		// 因为其最终的显示为：下拉框有一个背景颜色且下拉框的字体有一个背景颜色，重叠后的效果展示；
		/* background-color: transparent; */
		border: none;
	}

	/* // 设置下拉框的字体属性及背景颜色； */
	.el-select-dropdown__item {
		color: #fff;
		background-color: #004289;
	}

	/* // 设置下拉框列表的 padding 值为：0；(即：样式调整) */
	/deep/.el-select-dropdown__list {
		padding: 0;
	}

	/* // 设置输入框与下拉框的距离为：0; (即：样式调整) */
	/deep/.el-popper[x-placement^="bottom"] {
		margin-top: 0px;
	}

	/* // 将下拉框上的小箭头取消；(看着像一个箭头，其实是两个重叠在一起的箭头) */
	/deep/.el-popper .popper__arrow,
	/deep/.el-popper .popper__arrow::after {
		display: none;
	}

	/* // 设置鼠标悬停在下拉框列表的悬停色； */
	.el-select-dropdown__item:hover {
		background-color: rgba(0, 136, 255, 0.8);
	}

	.def-text {
		width: 30%;
		position: relative;
		z-index: 1;
		font-family: SourceHanSansSC-Regular;
		font-size: 16px;
		color: #FFFFFF;
		letter-spacing: 0;
		line-height: 22.4px;
		font-weight: 400;
	}

	.btn-text {
		font-family: SourceHanSansSC-Normal;
		font-size: 16px;
		color: #FFFFFF;
		letter-spacing: 1.6px;
		text-align: center;
		line-height: 26.4px;
		font-weight: 400;
	}

	.add-btn {
		background: #030A28;
		background-image: linear-gradient(180deg, rgba(72, 156, 255, 0.13) 0%, rgba(43, 186, 255, 0.18) 49%, rgba(0, 138, 255, 0.50) 100%);
		box-shadow: inset 0 0 11px 0 #05DCF8;
		width: 7.9vw;
		height: 3.3vh;
		border-radius: 20px;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-top: 2vh;
		margin-right: 2vh;
	}
    
	.add-btn1 {
		background: #030A28;
		background-image: linear-gradient(180deg, rgba(72, 156, 255, 0.13) 0%, rgba(43, 186, 255, 0.18) 49%, rgba(0, 138, 255, 0.50) 100%);
		box-shadow: inset 0 0 11px 0 #05DCF8;
		width: 7vw;
		height: 3.3vh;
		border-radius: 20px;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-top: 2vh;
		margin-right: 2vh;
	}
	
	.sub-btn {
		background: #030A28;
		background-image: linear-gradient(180deg, rgba(72, 156, 255, 0.13) 0%, rgba(43, 186, 255, 0.18) 49%, rgba(0, 138, 255, 0.50) 100%);
		box-shadow: inset 0 0 11px 0 #05DCF8;
		width: 7.9vw;
		height: 3.3vh;
		border-radius: 20px;
		display: flex;
		justify-content: center;
		align-items: center;
	}
</style>